Unification and ML-Type Reconstruction
نویسندگان
چکیده
We study the complexity of type reconstruction for a core fragment of ML with lambda abstraction, function application, and the polymorphic let declaration. We derive exponential upper and lower bounds on recognizing the typable core ML expressions. Our primary technical tool is uniication of succinctly represented type expressions. After observing that core ML expressions, of size n, can be typed in DTIME(2 n), we exhibit two diierent families of programs whose principal types grow exponentially. We show how to exploit the expressiveness of the let-polymorphism in these constructions to derive lower bounds on deciding typability: one leads naturally to NP-hardness and the other to DTIME(2 n k)-hardness for each integer k 1. Our generic simulation of any exponential time Turing Machine by ML type reconstruction may be viewed as a nonstandard way of computing with types. Our worst-case lower bounds stand in contrast to practical experience, which suggests that commonly used algorithms for type reconstruction do not slow compilation substantially.
منابع مشابه
Type Reconstruction for Type Classes
We study the type inference problem for a system with type classes as in the functional programming language Haskell. Type classes are an extension of ML-style polymorphism with overloading. We generalize Milner’s work on polymorphism by introducing a separate context constraining the type variables in a typing judgement. This leads to simple type inference systems and algorithms which closely ...
متن کاملWand’s Algorithm Extended For the Polymorphic ML-Let
This paper details an extension to Wand’s algorithm to handle the polymorphic let (a.k.a. ML-Let) construct. We have extended Wand’s algorithm by extending the constraint language and by using a multi-phase unification algorithm in the constraint solving phase. We show the correctness of our approach by extending the Wand’s soundness and completeness results. We have validated our approach agai...
متن کاملOn Extending Wand’s Type Reconstruction Algorithm to Handle Polymorphic Let⋆
We have extended Wand’s type reconstruction algorithm to polymorphic let by extending the constraint language and by using a multi-phase unification algorithm in the constraint solving phase. We show the correctness of our approach by extending the Wand’s soundness and completeness results. We have validated our approach against other popular type reconstruction algorithms by implementing OCaml...
متن کاملEliminating Redundancy in Higher-Order Unification: A Lightweight Approach
In this paper, we discuss a lightweight approach to eliminate the overhead due to implicit type arguments during higher-order unification of dependently-typed terms. First, we show that some implicit type information is uniquely determined, and can therefore be safely skipped during higher-order unification. Second, we discuss its impact in practice during type reconstruction and during proof s...
متن کاملWorking with Mathematical Structures in Type Theory
We address the problem of representing mathematical structures in a proof assistant which: 1) is based on a type theory with dependent types, telescopes and a computational version of Leibniz equality; 2) implements coercive subtyping, accepting multiple coherent paths between type families; 3) implements a restricted form of higher order unification and type reconstruction. We show how to expl...
متن کامل